package com.goldcn.user.dao;

import com.goldcn.user.model.Organizational;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

public interface OrganizationalMapper {
    int deleteByPrimaryKey(Long oID);

    int insert(Organizational record);

    int insertSelective(Organizational record);

    Organizational selectByPrimaryKey(Long oID);

    Organizational selectByOID(Long oID);

    int updateByPrimaryKeySelective(Organizational record);

    int updateByPrimaryKey(Organizational record);

    Organizational selectByName(@Param(value = "ozName") String ozName, @Param(value = "companyID") Long companyID);

    List<Organizational> selectForDeleteJudge(Long oID);

    Organizational selectHeadCCB(Long companyID);

    List<Organizational> selectSubBankList(Organizational organizational);

    List<Long> selectSubOIDList(Map<String, Object> params);

    Long selectIDByName(@Param(value = "oName") String oName, @Param(value = "companyID") Long companyID);

    Organizational selectByContactPhone(@Param(value = "contactPhone") String contactPhone, @Param(value = "companyID") Long companyID);

    List<Map<String,Object>> selectNameListByOID(List<Long> list);

    List<Map<String,Object>> selectNameListByOIDAllState(List<Long> list);

    Organizational getLevel1Org(Long companyID);

    List<Organizational> getHasNextOrg(Long oId);

    List<Organizational> getHasNextOrgAllState(Long oId);

    List<Organizational> selectAllOrg(Long companyID); //出了总部

    Long countByname(@Param(value = "oName") String oName, @Param(value = "companyID") Long companyID);

    List<Organizational> getAll(Long companyID);

    List<Organizational> getSubordinateOrg(Organizational organizational);

    List<Organizational> selectOrgByLikeName(@Param(value = "orgName") String orgName, @Param(value = "companyID") Long companyID);

    /**
     * 统计二级分部数量
     * @param oID
     * @return
     */
    Long countTwoLevelBranchNum(Long oID);

    /**
     * 统计支部数量
     * @param oID
     * @return
     */
    Long countSubbranchNum(@Param("level") Integer level, @Param("oID") Long oID);

    Map<String,Object> getAllOrgCount(Long companyID);

    List<Organizational> selectByAdminID(Long adminID);

    Organizational selectTopDept(@Param("companyID") Long companyID);

    int updateAdmin(@Param("adminID") Long adminID, @Param("oID") Long oID);

    int clearAdmin(@Param("oID") Long oID);




    Organizational getOrgInfoByMallShopID(@Param("shopID") Long shopID);

}